package com.talos.ums.dal.mysql.appversion;

import com.talos.framework.common.pojo.PageResult;
import com.talos.framework.mybatis.core.mapper.BaseMapperX;
import com.talos.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.talos.ums.controller.admin.appversion.vo.UmsAppVersionPageReqVO;
import com.talos.ums.dal.dataobject.appversion.UmsAppVersionDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 移动应用版本管理 Mapper
 *
 * @author ${table.author}
 */
@Mapper
public interface UmsAppVersionMapper extends BaseMapperX<UmsAppVersionDO> {

    default PageResult<UmsAppVersionDO> selectPage(UmsAppVersionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UmsAppVersionDO>()
                .eqIfPresent(UmsAppVersionDO::getSource, reqVO.getSource())
                .eqIfPresent(UmsAppVersionDO::getType, reqVO.getType())
                .eqIfPresent(UmsAppVersionDO::getVersionNum, reqVO.getVersionNum())
                .eqIfPresent(UmsAppVersionDO::getUrl, reqVO.getUrl())
                .eqIfPresent(UmsAppVersionDO::getTips, reqVO.getTips())
                .eqIfPresent(UmsAppVersionDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(UmsAppVersionDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(UmsAppVersionDO::getCreatorCode, reqVO.getCreatorCode())
                .likeIfPresent(UmsAppVersionDO::getCreatorName, reqVO.getCreatorName())
                .betweenIfPresent(UmsAppVersionDO::getModifyTime, reqVO.getModifyTime())
                .eqIfPresent(UmsAppVersionDO::getModifierCode, reqVO.getModifierCode())
                .likeIfPresent(UmsAppVersionDO::getModifierName, reqVO.getModifierName())
                .eqIfPresent(UmsAppVersionDO::getDeleted, reqVO.getDeleted())
                .eqIfPresent(UmsAppVersionDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(UmsAppVersionDO::getId));
    }

}
